<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加单词</title>
    <style>
        body {
            display: flex;
            flex-direction: column;
            /* justify-content: center; */
            align-items: center;
            min-height: 100vh;
            margin: 0;
            padding: 20px;
            box-sizing: border-box;
        }

        #addWordForm {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .form-group {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
        }

        .form-group label {
            width: 100px;
            text-align: right;
            margin-right: 10px;
        }

        .form-group input {
            width: 200px;
        }

        #addWordForm button {
            margin: 0 5px;
        }

        .button-group {
            display: flex;
            justify-content: center;
            width: 100%;
        }

        .error-message {
            color: red;
        }
    </style>
</head>
<body>
    <!-- 引入导航栏 -->
    {% include 'navbar.html' %}

    <h1>添加单词</h1>
    <form id="addWordForm" action="/addword" method="post">
        <div class="form-group">
            <label for="chinese">汉字:</label>
            <input type="text" id="chinese" name="chinese" value="{{ chinese | default('', true) }}" required>
        </div>
        <div class="form-group">
            <label for="hiragana">平假名:</label>
            <input type="text" id="hiragana" name="hiragana" value="{{ hiragana | default('', true) }}" required>
        </div>
        <div class="form-group">
            <label for="category">分类:</label>
            <input type="text" id="category" name="category" value="{{ category | default('', true) }}" required>
        </div>
        <div class="form-group">
            <label for="meaning">中文释义:</label>
            <input type="text" id="meaning" name="meaning" value="{{ meaning | default('', true) }}" required>
        </div>
        <div class="button-group">
            <button type="reset">重置</button>
            <button type="submit">提交</button>
        </div>
    </form>
    {% if error_message %}
        <p class="error-message">{{ error_message }}</p>
    {% endif %}
</body>
</html>